package com.zgjkhis.modules.system.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.zgjkhis.modules.system.domain.vo.DrugDeliveryDetailVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @Author yzq
 * @Description 供应商
 * @Date 2021/6/23 9:38
 * @Param
 * @return
 **/
@Data
@TableName("his_drug_delivery")
public class DrugDelivery implements Serializable {

    @TableId
    @ApiModelProperty(value = "主键id(修改时必填)")
    private Long id;
    @ApiModelProperty(value = "出库方式1：科室领用，2：报损，3员工取药，4：门店调拨，5盘点出库")
    private Integer deliveryType;
    @ApiModelProperty(value = "订单状态1：待审核，2：已审核，3：已取消")
    private Integer status;
    @ApiModelProperty(value = "订单号")
    private String deliveryNo;
    @ApiModelProperty(value = "领用科室(可以不传,根据科室id，查询对应的科室名称)")
    private String collectDeptName;
    @ApiModelProperty(value = "领用科室id")
    private String collectDeptId;
    @ApiModelProperty(value = "领用人名称(可以不传,根据领用人id，查询对应的领用人名称)")
    private String collectUseName;
    @ApiModelProperty(value = "领用人id")
    private String collectUseId;
    @ApiModelProperty(value = "备注")
    private String remark;
    @ApiModelProperty(value = "审核人")
    private String checkUserId;
    @ApiModelProperty(value = "审核人姓名")
    private String checkUserName;
    @ApiModelProperty(value = "审核时间")
    private Date checkTime;
    @ApiModelProperty(value = "药房门店id")
    private String pharmacyId;
    @TableField(fill= FieldFill.INSERT)
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;
    @ApiModelProperty(value = "制单人id")
    private String createUserId;
    @ApiModelProperty(value = "制单人姓名")
    private String createUserName;
    @ApiModelProperty(value = "出库清单详情")
    @Size(min=1,message = "清单详情不能为空")
    @TableField(exist = false)
    private List<DrugDeliveryDetailVO> list;

    @ApiModelProperty(value = "药品类型")
    private Integer drugType;
    @ApiModelProperty(value = "出库药品数量")
    private Integer deliveryQuantity;

    public void copy(DrugDelivery source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
